package file;

import java.io.File;
import java.io.IOException;

public class Demo1 {
	public static void main(String[] args) throws IOException {

		File fj = new File("D:\\aa\\bb\\cc");
		fj.mkdirs();
		File f1 = new File("D:\\aa\\bb\\cc\\a.txt");
		f1.createNewFile();
		File f2 = new File("D:\\aa\\bb\\a.txt");
		f2.createNewFile();
		File f3 = new File("D:\\aa\\bb\\b.txt");
		f3.createNewFile();
		File f4 = new File("D:\\aa\\b.txt");
		f4.createNewFile();

		File f = new File("D:\\aa");
		delDir(f);
	}

	private static void delDir(File f) {
		File[] fs = f.listFiles();
		for (File ft : fs) {
			if (ft.isFile()) {
				System.out.println(ft.getPath());
				ft.delete();
			} else 
				delDir(ft);
		}
		System.out.println(f.getPath());
		f.delete();
	}
}
